import java.util.Scanner;

public class Exam04 {
    public static void main(String[] args) {
        // 杨辉三角
        // 1
        // 11
        // 121
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入行数");
        int n = sc.nextInt();
        int[][] yHThree = yHThree(n);
        for (int[] t : yHThree) {
            for (int i : t) {
                System.out.print(i == 0 ? "" : i + "\t");
            }
            System.out.println();
        }
    }

    public static int[][] yHThree(int n) {
        int[][] th = new int[n][n];
        for (int i = 0; i < th.length; i++) {
            for (int j = 0; j <= i; j++) {
                // th[i][j] 当前的格子
                if (i == 0 || i == 1) {
                    th[i][j] = 1;
                } else if (j == 0 || j == i) {
                    th[i][j] = 1;
                } else {
                    th[i][j] = th[i - 1][j] + th[i - 1][j - 1];
                }
            }
        }
        return th;
    }
}
